nameEstW <- function(cond, targ){
	Y <- targ
	X <- cond
	Yt <- Y
	orderind <- intersect(names(Yt), rownames(X))
	Yt <- Yt[orderind]
	X <- X[orderind,]
	dat <- data.frame(targ = Yt, X)
	w <- NULL
	lm.out <- lm(targ ~ . -1, data = dat, weights = w)
	cookd <- cooks.distance(lm.out)
	w <- 1/exp(cookd)
	Yt <- Yt[row.names(X)]
	Ytt <- w*Yt
	Ytt[is.na(Ytt)] <- 0
	Xtt <- matrix(w, ncol = ncol(X), nrow = length(w))*X
	Xtt[is.na(Xtt)] <- 0
	designmat <- model.matrix(Ytt ~ -1 + Xtt)
	Dmat <- crossprod(designmat, designmat)
	pdind <- is.positive.definite(Dmat)
	if(pdind == FALSE){Dmat <- make.positive.definite(Dmat)}
	dvec <- crossprod(designmat, Ytt)
	#Amat <- cbind(1, diag(nrow(Dmat)))
	#bvec <- c(1, rep(0, nrow(Dmat)))
	Amat <- cbind(
    matrix(1, nr=length(dvec), nc=1),
    diag(length(dvec)),
    -diag(length(dvec))
  	)
	bvec <- c(1, rep(0, length(dvec)), rep(-1, length(dvec)))
	meq <- 1
	resTmp <- tryCatch(expr = solve.QP(Dmat, dvec, Amat, bvec, meq, factorized = F)[[1]], error = function(e) rep(NA, ncol(X)))
	out <- round(resTmp, 5)
	names(out) <- colnames(X)
	return(out)
}